<?php
//自动加载
require __DIR__."/../vendor/autoload.php";
//实例化服务
$app = new Illuminate\Container\Container;
Illuminate\Container\Container::setInstance($app);
//注册事件
$event = new Illuminate\Events\EventServiceProvider($app);
$event->register();
//路由服务提供者
$route = new Illuminate\Routing\RoutingServiceProvider($app);
$route->register();
//启动Eloquent ORM模块并且进行配置
$manager = new Illuminate\Database\Capsule\Manager();
$database_config = require '../config/database.php';
$manager->addConnection($database_config);
$manager->bootEloquent();
$app->instance('config', new Illuminate\Support\Fluent());
$app['config']['view.compiled'] = __DIR__ . "/../bootstrap/cache";
$app['config']['view.paths'] = [__DIR__ . "/../app/resources/views"];
$view = new Illuminate\View\ViewServiceProvider($app);
$view->register();
$filesystem = new Illuminate\Filesystem\FilesystemServiceProvider($app);
$filesystem->register();
//加载路由
require __DIR__."/../app/Http/routes.php";
//实例化请求并分发处理请求
$request = Illuminate\Http\Request::createFromGlobals();
$response = $app['router']->dispatch($request);
$response->send();